from abc import ABC, abstractmethod

# Abstraction
class Abstraction(ABC):
    def __init__(self, implementor):
        self.implementor = implementor

    @abstractmethod
    def operation(self):
        pass

# RefinedAbstraction
class RefinedAbstraction(Abstraction):
    def operation(self):
        print("RefinedAbstraction operation")
        self.implementor.operationImpl()

# Implementor
class Implementor(ABC):
    @abstractmethod
    def operationImpl(self):
        pass

# ConcreteImplementorA
class ConcreteImplementorA(Implementor):
    def operationImpl(self):
        print("ConcreteImplementorA operationImpl")

# ConcreteImplementorB
class ConcreteImplementorB(Implementor):
    def operationImpl(self):
        print("ConcreteImplementorB operationImpl")

# Client
class Client:
    def __init__(self, abstraction):
        self.abstraction = abstraction

    def execute(self):
        self.abstraction.operation()

# Usage
if __name__ == "__main__":
    implementorA = ConcreteImplementorA()
    refinedAbstraction = RefinedAbstraction(implementorA)
    client = Client(refinedAbstraction)
    client.execute()

# 运行结果
# RefinedAbstraction operation
# ConcreteImplementorA operationImpl